<template>
  <div class="menu-bar-root-container">
    <div class="menu-bar-root-left">
      <BackButton />
      <PresetLoader />
    </div>
    <div class="menu-bar-root-right">
      <NextButton :beforeNext="checkBeforeNext" />
    </div>
  </div>
</template>

<script setup>
import usePlanningStore from "@/stores/planningStore.js";
import PresetLoader from "./PresetLoader.vue";
import BackButton from "../components/BackButton.vue";
import NextButton from "../components/NextButton";

const planningStore = usePlanningStore();

const checkBeforeNext = () => {
  for (let i = 0; i < planningStore.timeSlots.length; i++) {
    if (planningStore.timeSlots[i].seats.length > 0) {
      return true;
    }
  }
  ElMessage.error("请先选择值班时段的席位");
  return false;
};
</script>

<style scoped>
@import "../styles/MenuBar.css";
</style>
